const fs = require('fs');

const getFile = (path) => {
    return new Promise((resolve, reject) => {
        fs.readFile(path, (err, data) => {
            if (err) {
                console.log("文件读取失败");
                reject(err)
            }
            resolve(data.toString())
        })
    })
}

const setFile = (path, data) => {
    return new Promise((resolve, reject) => {
        fs.writeFile(path, data, err => {
            if (err) {
                reject(fasle)
            }
            resolve(true)
        })
    })
}


module.exports = { getFile, setFile }